' Charlie Veniot's BASIC Anywhere Machine mod of the program by B+
' found at https://qb64phoenix.com/forum/showthread.php?tid=1478&pid=13587#pid13587
_Title "Do the dots in disk look like they are spinning?" ' B+ 2019-01-12
'try an optical illusion saw on Internet
DECLARE SUB fcirc( cx AS LONG, cy AS LONG, r AS LONG, couleur AS INTEGER)
CONST xmax = 600, ymax = 600
SCREEN _NEWIMAGE(xmax, ymax, 24)
roundAroundLmt = 3
x0 = xmax / 2: y0 = ymax / 2: a24 = _PI(2 / 24): r = 240
DO
    IF loopcnt < roundAroundLmt THEN tinyCircleCnt = 11
    IF loopcnt = roundAroundLmt THEN tinyCircleCnt = 0
    IF loopcnt > roundAroundLmt THEN
        IF tinyCircleCnt < 11 THEN tinyCircleCnt = tinyCircleCnt + 1
    END IF
    FOR a = 0 TO _PI(2) STEP [_PI / 180]
        fcirc(x0, y0, 251, _RGB32(82, 82, 82))
        FOR i = 0 TO tinyCircleCnt
            IF loopcnt > [roundAroundLmt - 1] THEN
                a24i = [a24 * i]
                xs = [x0] + [r * COS(a24i)]
                ys = [y0] + [r * SIN(a24i)]
                xe = [x0] + [r * COS(a24i + _PI)]
                ye = [y0] + [r * SIN(a24i + _PI)]
                LINE (xs, ys)-(xe, ye), _RGB32(255, 255, 255)
            END IF
            cv1 = COS([a] + [_PI(i/12)])
            x = [x0] + [cv1 * r * COS(a24*i)]
            y = [y0] + [cv1 * r * SIN(a24*i)]
            fcirc(x, y, 10, _RGB32(255, 255, 255))
        NEXT i
        _DELAY 0.004
    NEXT a
    loopcnt = [loopcnt MOD 15] + [1]
LOOP
'Steve McNeil's  copied from his forum   note: Radius is too common a name
SUB fcirc (cx AS LONG, cy AS LONG, r AS LONG, couleur AS INTEGER)
    VAR AS LONG subRadius, RadiusError, x, y
    subRadius = ABS(r)
    RadiusError = -subRadius
    x = subRadius
    y = 0
    IF subRadius = 0 THEN PSET (cx, cy), couleur: EXIT SUB
    ' Draw the middle span here so we don't draw it twice in the main loop,
    ' which would be a problem with blending turned on.
    LINE ( [cx - x] , [cy] ) - ( [cx + x] , [cy] ), couleur , BF
    WHILE x > y
        RadiusError = [RadiusError] + [y * 2] + [1]
        IF RadiusError >= 0 THEN
            IF x <> y + 1 THEN
                LINE ( [cx - y] , [cy - x] ) - ( [cx + y] , [cy - x] ), couleur , BF
                LINE ( [cx - y] , [cy + x] ) - ( [cx + y] , [cy + x] ), couleur , BF
            END IF
            x = [x - 1]
            RadiusError = [RadiusError] - [x * 2]
        END IF
        y = [y + 1]
        LINE ( [cx - x], [cy - y] )-( [cx + x], [cy - y] ), couleur , BF
        LINE ( [cx - x], [cy + y] )-( [cx + x], [cy + y] ), couleur , BF
    WEND
END SUB